home *** CD-ROM | disk | FTP | other *** search
- Path: isonews.bbn.hp.com!hpbblb!news
- From: Matthias Dittrich <matti>
- Newsgroups: comp.lang.c
- Subject: Re: HELP! Please! Why doesn't this work
- Date: 21 Feb 1996 10:08:45 GMT
- Organization: Hewlett-Packard Co.
- Message-ID: <4geqvd$jse@hpbblb.bbn.hp.com>
- References: <Pine.ULT.3.91a.960215131933.614A-100000@red5.cac.washington.edu>
- NNTP-Posting-Host: trabant.bbn.hp.com
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 1.1N (X11; I; HP-UX A.09.07 9000/712)
- X-URL: news:Pine.ULT.3.91a.960215131933.614A-100000@red5.cac.washington.edu
-
- "Aaron T. Baldie" <atb@cac.washington.edu> wrote:
- >...
- >main()
- >{
- > char **solution_array;
- > int size, row, col;
- > size = 20;
- > solution_array = (char **) malloc(size);
- You must allocate more memory because these are the bytes to be allocated:
- solution_array = (char **) malloc(size * sizeof(char **));
- ^^^^^^^^^^^^^^^^^^
- > for (row=0; row<size; row++){
- > solution_array[row] = (char *) malloc(size);
- here too:
- solution_array[row] = (char *) malloc(size * sizeof(char *));
- ^^^^^^^^^^^^^^^^^
- > }
- >
- > initialize_array(solution_array, size);
- > print_maze(solution_array, size)
- >}
- >...
- Good luck,
- Matthias
-
-